package MyGraph;

public class Rectangle<T extends Number> extends MyShape{
	public MyPoint<T> left_top_point;
	private T length;
	private T width;
	public Rectangle(){}
	public Rectangle(T x,T y,T l,T w){
		super();
		left_top_point = new MyPoint(x,y,"R");
		length = l;
		width = w;
	}
	public double calArea(){
		return length.longValue()*width.doubleValue();
	}
	public double calPerimeter(){
		return 2*(length.doubleValue()+width.doubleValue());
	}
        @Override
	public String toString(){
		String ret ="[left_top_point:" + left_top_point;
		ret+=" width="+width;
                ret+=" height="+length+"]";
		return ret;}
}
